{% extends "base.html" %}

{% block content %}

<div class="py-5 text-center" style="">
    <div class="container">
        <div class="row">
            <div class="mx-auto col-md-6 col-10 bg-white p-5">
                <h1 class="mb-4">Log in</h1>
                <form method="post" action="{% url 'login' %}">
                    {% csrf_token %}
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Username" required name="username">
                    </div>
                    <div class="form-group mb-3">
                        <input type="password" class="form-control" placeholder="Password" required name="password">
                    </div>
                    {% if form.errors %}
                    <p>Your username and password didn't match. Please try again.</p>
                    {% endif %}

                    {% if next %}
                    {% if user.is_authenticated %}
                    <p>Your account doesn't have access to this page. To proceed,
                        please login with an account that has access.</p>
                    {% else %}
                    <p>Please login to see this page.</p>
                    {% endif %}
                    {% endif %}
                    <button type="submit" class="btn btn-primary">Submit</button>
                    <input type="hidden" name="next" value="{{ next }}">
                </form>
            </div>
        </div>
    </div>
</div>

{% endblock %}